//接口地址  http://api.xiaohigh.com/goods
import { useEffect } from "react";
import instance from "../utils/request";
import { GoodsItem } from "../api/goods/types";

export default function InstanceCom() {
  useEffect(() => {
    //发送请求
    let getData = async () => {
      //请求商品数据. get 方法的第二个类型参数, 设置的是 axios 返回 promise 对象成功结果值的类型
      let result = await instance.get<any, GoodsItem[]>('/goods');
      //输出
      console.log(result);
      // result[0].
    }

    getData();
  }, [])

  return <div>
    <h2>商品列表 - 2</h2>
  </div>;
}
